package com.sponsorpay.sdk.android.utils;

import android.util.Log;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class SponsorPayLogger
{
  private static SponsorPayLogger INSTANCE = new SponsorPayLogger();
  private static boolean logging = false;
  private Set<SPLoggerListener> listeners = new HashSet();

  public static boolean addLoggerListener(SPLoggerListener paramSPLoggerListener)
  {
    return INSTANCE.listeners.add(paramSPLoggerListener);
  }

  public static void d(String paramString1, String paramString2)
  {
    if (logging)
    {
      Log.d(paramString1, paramString2);
      INSTANCE.log(Level.DEBUG, paramString1, paramString2, null);
    }
  }

  public static void e(String paramString1, String paramString2)
  {
    if (logging)
    {
      Log.e(paramString1, paramString2);
      INSTANCE.log(Level.ERROR, paramString1, paramString2, null);
    }
  }

  public static void e(String paramString1, String paramString2, Exception paramException)
  {
    if (logging)
    {
      Log.w(paramString1, paramString2, paramException);
      INSTANCE.log(Level.ERROR, paramString1, paramString2, paramException);
    }
  }

  public static boolean enableLogging(boolean paramBoolean)
  {
    logging = paramBoolean;
    return logging;
  }

  public static void i(String paramString1, String paramString2)
  {
    if (logging)
    {
      Log.i(paramString1, paramString2);
      INSTANCE.log(Level.INFO, paramString1, paramString2, null);
    }
  }

  public static boolean isLogging()
  {
    return logging;
  }

  public static boolean removeLoggerListener(SPLoggerListener paramSPLoggerListener)
  {
    return INSTANCE.listeners.remove(paramSPLoggerListener);
  }

  public static boolean toggleLogging()
  {
    if (logging);
    for (boolean bool = false; ; bool = true)
    {
      logging = bool;
      return logging;
    }
  }

  public static void v(String paramString1, String paramString2)
  {
    if (logging)
    {
      Log.v(paramString1, paramString2);
      INSTANCE.log(Level.VERBOSE, paramString1, paramString2, null);
    }
  }

  public static void w(String paramString1, String paramString2)
  {
    if (logging)
    {
      Log.w(paramString1, paramString2);
      INSTANCE.log(Level.WARNING, paramString1, paramString2, null);
    }
  }

  public static void w(String paramString1, String paramString2, Exception paramException)
  {
    if (logging)
    {
      Log.w(paramString1, paramString2, paramException);
      INSTANCE.log(Level.WARNING, paramString1, paramString2, paramException);
    }
  }

  public void log(final Level paramLevel, final String paramString1, final String paramString2, final Exception paramException)
  {
    if (!this.listeners.isEmpty())
      new Thread(new Runnable()
      {
        public void run()
        {
          Iterator localIterator = SponsorPayLogger.this.listeners.iterator();
          while (true)
          {
            if (!localIterator.hasNext())
              return;
            ((SPLoggerListener)localIterator.next()).log(paramLevel, paramString1, paramString2, paramException);
          }
        }
      }).start();
  }

  public static enum Level
  {
    static
    {
      DEBUG = new Level("DEBUG", 1);
      INFO = new Level("INFO", 2);
      WARNING = new Level("WARNING", 3);
      ERROR = new Level("ERROR", 4);
      Level[] arrayOfLevel = new Level[5];
      arrayOfLevel[0] = VERBOSE;
      arrayOfLevel[1] = DEBUG;
      arrayOfLevel[2] = INFO;
      arrayOfLevel[3] = WARNING;
      arrayOfLevel[4] = ERROR;
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.sponsorpay.sdk.android.utils.SponsorPayLogger
 * JD-Core Version:    0.6.2
 */